package cn.t17.appsys.controller;

import cn.t17.appsys.dto.CommonResponse;
import cn.t17.appsys.util.Constants;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * LogoutController class
 *
 * @author Administrator
 * @date 2021/9/24
 */
@CrossOrigin(allowCredentials = "true")
@RestController
public class LogoutController extends BaseController{
    @RequestMapping(value = "logout", method = RequestMethod.POST)
    public CommonResponse<?> doLogin(HttpSession session) {
        Object user = session.getAttribute(Constants.SESSION_USER);
        System.out.println(user);
        // 消毁session对象
        session.invalidate();
        return success("退出成功");
    }
}
